package com.mingte.manghe.utils;

import java.util.Base64;

/**
 * base64加解密
 */
public class Base64Utils {

    /**
     * 加密
     * @param origin
     * @return
     */
    public static String encode(String origin){
        if(StringUtils.isNotEmpty(origin)){
            byte[] encode = Base64.getEncoder().encode(origin.getBytes());
            return new String(encode);
        }
        return null;
    }

    /**
     * 加密
     * @param origin
     * @return
     */
    public static String decode(String origin){
        if(StringUtils.isNotEmpty(origin)){
            byte[] decode = Base64.getDecoder().decode(origin);
            return new String(decode);
        }
        return null;
    }

}
